package error2

import (
	"errors"
	"fmt"
)

func Sqrt(f float64) (float64, error) {
	if f < 0 {
		return 0, errors.New("math: square root of negative number")
	}
	return Sqrt(f)
}

func TestError() {

	sqrt, err := Sqrt(-0.1)
	if err != nil {
		fmt.Println("error is ", err)
	} else {
		fmt.Println(sqrt)
	}

}
